package torque.generated;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.map.TableMap;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;





/**
 * la partie
 *
 * This class was autogenerated by Torque on:
 *
 * [Wed Oct 16 17:21:00 CEST 2013]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Partie
 */
public abstract class BasePartie extends BaseObject
{
    /** Serial version */
    private static final long serialVersionUID = 1381936860962L;

    /** The Peer class */
    private static final PartiePeer peer =
        new PartiePeer();


    /** The value for the idPartie field */
    private String idPartie;

    /** The value for the libelle field */
    private String libelle;


    /**
     * Get the IdPartie
     *
     * @return String
     */
    public String getIdPartie()
    {
        return idPartie;
    }


    /**
     * Set the value of IdPartie
     *
     * @param v new value
     */
    public void setIdPartie(String v) throws TorqueException
    {

        if (!ObjectUtils.equals(this.idPartie, v))
        {
            this.idPartie = v;
            setModified(true);
        }



        // update associated Save
        if (collSaves != null)
        {
            for (int i = 0; i < collSaves.size(); i++)
            {
                ((Save) collSaves.get(i))
                        .setIdPartie(v);
            }
        }

        // update associated Equiper
        if (collEquipers != null)
        {
            for (int i = 0; i < collEquipers.size(); i++)
            {
                ((Equiper) collEquipers.get(i))
                        .setIdPartie(v);
            }
        }

        // update associated Ramasser
        if (collRamassers != null)
        {
            for (int i = 0; i < collRamassers.size(); i++)
            {
                ((Ramasser) collRamassers.get(i))
                        .setIdPartie(v);
            }
        }

        // update associated Utiliser
        if (collUtilisers != null)
        {
            for (int i = 0; i < collUtilisers.size(); i++)
            {
                ((Utiliser) collUtilisers.get(i))
                        .setIdPartie(v);
            }
        }

        // update associated Place
        if (collPlaces != null)
        {
            for (int i = 0; i < collPlaces.size(); i++)
            {
                ((Place) collPlaces.get(i))
                        .setIdPartie(v);
            }
        }
    }

    /**
     * Get the Libelle
     *
     * @return String
     */
    public String getLibelle()
    {
        return libelle;
    }


    /**
     * Set the value of Libelle
     *
     * @param v new value
     */
    public void setLibelle(String v) 
    {

        if (!ObjectUtils.equals(this.libelle, v))
        {
            this.libelle = v;
            setModified(true);
        }


    }

       


    /**
     * Collection to store aggregation of collSaves
     */
    protected List collSaves;

    /**
     * Temporary storage of collSaves to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initSaves()
    {
        if (collSaves == null)
        {
            collSaves = new ArrayList();
        }
    }


    /**
     * Method called to associate a Save object to this object
     * through the Save foreign key attribute
     *
     * @param l Save
     * @throws TorqueException
     */
    public void addSave(Save l) throws TorqueException
    {
        getSaves().add(l);
        l.setPartie((Partie) this);
    }

    /**
     * Method called to associate a Save object to this object
     * through the Save foreign key attribute using connection.
     *
     * @param l Save
     * @throws TorqueException
     */
    public void addSave(Save l, Connection con) throws TorqueException
    {
        getSaves(con).add(l);
        l.setPartie((Partie) this);
    }

    /**
     * The criteria used to select the current contents of collSaves
     */
    private Criteria lastSavesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getSaves(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getSaves()
        throws TorqueException
    {
        if (collSaves == null)
        {
            collSaves = getSaves(new Criteria(10));
        }
        return collSaves;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie has previously
     * been saved, it will retrieve related Saves from storage.
     * If this Partie is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getSaves(Criteria criteria) throws TorqueException
    {
        if (collSaves == null)
        {
            if (isNew())
            {
               collSaves = new ArrayList();
            }
            else
            {
                criteria.add(SavePeer.ID_PARTIE, getIdPartie() );
                collSaves = SavePeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(SavePeer.ID_PARTIE, getIdPartie());
                if (!lastSavesCriteria.equals(criteria))
                {
                    collSaves = SavePeer.doSelect(criteria);
                }
            }
        }
        lastSavesCriteria = criteria;

        return collSaves;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getSaves(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getSaves(Connection con) throws TorqueException
    {
        if (collSaves == null)
        {
            collSaves = getSaves(new Criteria(10), con);
        }
        return collSaves;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie has previously
     * been saved, it will retrieve related Saves from storage.
     * If this Partie is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getSaves(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collSaves == null)
        {
            if (isNew())
            {
               collSaves = new ArrayList();
            }
            else
            {
                 criteria.add(SavePeer.ID_PARTIE, getIdPartie());
                 collSaves = SavePeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(SavePeer.ID_PARTIE, getIdPartie());
                 if (!lastSavesCriteria.equals(criteria))
                 {
                     collSaves = SavePeer.doSelect(criteria, con);
                 }
             }
         }
         lastSavesCriteria = criteria;

         return collSaves;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Saves from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getSavesJoinPartie(Criteria criteria)
        throws TorqueException
    {
        if (collSaves == null)
        {
            if (isNew())
            {
               collSaves = new ArrayList();
            }
            else
            {
                criteria.add(SavePeer.ID_PARTIE, getIdPartie());
                collSaves = SavePeer.doSelectJoinPartie(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(SavePeer.ID_PARTIE, getIdPartie());
            if (!lastSavesCriteria.equals(criteria))
            {
                collSaves = SavePeer.doSelectJoinPartie(criteria);
            }
        }
        lastSavesCriteria = criteria;

        return collSaves;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Saves from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getSavesJoinEchiquier(Criteria criteria)
        throws TorqueException
    {
        if (collSaves == null)
        {
            if (isNew())
            {
               collSaves = new ArrayList();
            }
            else
            {
                criteria.add(SavePeer.ID_PARTIE, getIdPartie());
                collSaves = SavePeer.doSelectJoinEchiquier(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(SavePeer.ID_PARTIE, getIdPartie());
            if (!lastSavesCriteria.equals(criteria))
            {
                collSaves = SavePeer.doSelectJoinEchiquier(criteria);
            }
        }
        lastSavesCriteria = criteria;

        return collSaves;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Saves from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getSavesJoinTroll(Criteria criteria)
        throws TorqueException
    {
        if (collSaves == null)
        {
            if (isNew())
            {
               collSaves = new ArrayList();
            }
            else
            {
                criteria.add(SavePeer.ID_PARTIE, getIdPartie());
                collSaves = SavePeer.doSelectJoinTroll(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(SavePeer.ID_PARTIE, getIdPartie());
            if (!lastSavesCriteria.equals(criteria))
            {
                collSaves = SavePeer.doSelectJoinTroll(criteria);
            }
        }
        lastSavesCriteria = criteria;

        return collSaves;
    }





    /**
     * Collection to store aggregation of collEquipers
     */
    protected List collEquipers;

    /**
     * Temporary storage of collEquipers to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initEquipers()
    {
        if (collEquipers == null)
        {
            collEquipers = new ArrayList();
        }
    }


    /**
     * Method called to associate a Equiper object to this object
     * through the Equiper foreign key attribute
     *
     * @param l Equiper
     * @throws TorqueException
     */
    public void addEquiper(Equiper l) throws TorqueException
    {
        getEquipers().add(l);
        l.setPartie((Partie) this);
    }

    /**
     * Method called to associate a Equiper object to this object
     * through the Equiper foreign key attribute using connection.
     *
     * @param l Equiper
     * @throws TorqueException
     */
    public void addEquiper(Equiper l, Connection con) throws TorqueException
    {
        getEquipers(con).add(l);
        l.setPartie((Partie) this);
    }

    /**
     * The criteria used to select the current contents of collEquipers
     */
    private Criteria lastEquipersCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getEquipers(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getEquipers()
        throws TorqueException
    {
        if (collEquipers == null)
        {
            collEquipers = getEquipers(new Criteria(10));
        }
        return collEquipers;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie has previously
     * been saved, it will retrieve related Equipers from storage.
     * If this Partie is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getEquipers(Criteria criteria) throws TorqueException
    {
        if (collEquipers == null)
        {
            if (isNew())
            {
               collEquipers = new ArrayList();
            }
            else
            {
                criteria.add(EquiperPeer.ID_PARTIE, getIdPartie() );
                collEquipers = EquiperPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(EquiperPeer.ID_PARTIE, getIdPartie());
                if (!lastEquipersCriteria.equals(criteria))
                {
                    collEquipers = EquiperPeer.doSelect(criteria);
                }
            }
        }
        lastEquipersCriteria = criteria;

        return collEquipers;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getEquipers(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getEquipers(Connection con) throws TorqueException
    {
        if (collEquipers == null)
        {
            collEquipers = getEquipers(new Criteria(10), con);
        }
        return collEquipers;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie has previously
     * been saved, it will retrieve related Equipers from storage.
     * If this Partie is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getEquipers(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collEquipers == null)
        {
            if (isNew())
            {
               collEquipers = new ArrayList();
            }
            else
            {
                 criteria.add(EquiperPeer.ID_PARTIE, getIdPartie());
                 collEquipers = EquiperPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(EquiperPeer.ID_PARTIE, getIdPartie());
                 if (!lastEquipersCriteria.equals(criteria))
                 {
                     collEquipers = EquiperPeer.doSelect(criteria, con);
                 }
             }
         }
         lastEquipersCriteria = criteria;

         return collEquipers;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Equipers from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getEquipersJoinPartie(Criteria criteria)
        throws TorqueException
    {
        if (collEquipers == null)
        {
            if (isNew())
            {
               collEquipers = new ArrayList();
            }
            else
            {
                criteria.add(EquiperPeer.ID_PARTIE, getIdPartie());
                collEquipers = EquiperPeer.doSelectJoinPartie(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(EquiperPeer.ID_PARTIE, getIdPartie());
            if (!lastEquipersCriteria.equals(criteria))
            {
                collEquipers = EquiperPeer.doSelectJoinPartie(criteria);
            }
        }
        lastEquipersCriteria = criteria;

        return collEquipers;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Equipers from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getEquipersJoinObjets(Criteria criteria)
        throws TorqueException
    {
        if (collEquipers == null)
        {
            if (isNew())
            {
               collEquipers = new ArrayList();
            }
            else
            {
                criteria.add(EquiperPeer.ID_PARTIE, getIdPartie());
                collEquipers = EquiperPeer.doSelectJoinObjets(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(EquiperPeer.ID_PARTIE, getIdPartie());
            if (!lastEquipersCriteria.equals(criteria))
            {
                collEquipers = EquiperPeer.doSelectJoinObjets(criteria);
            }
        }
        lastEquipersCriteria = criteria;

        return collEquipers;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Equipers from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getEquipersJoinTroll(Criteria criteria)
        throws TorqueException
    {
        if (collEquipers == null)
        {
            if (isNew())
            {
               collEquipers = new ArrayList();
            }
            else
            {
                criteria.add(EquiperPeer.ID_PARTIE, getIdPartie());
                collEquipers = EquiperPeer.doSelectJoinTroll(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(EquiperPeer.ID_PARTIE, getIdPartie());
            if (!lastEquipersCriteria.equals(criteria))
            {
                collEquipers = EquiperPeer.doSelectJoinTroll(criteria);
            }
        }
        lastEquipersCriteria = criteria;

        return collEquipers;
    }





    /**
     * Collection to store aggregation of collRamassers
     */
    protected List collRamassers;

    /**
     * Temporary storage of collRamassers to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initRamassers()
    {
        if (collRamassers == null)
        {
            collRamassers = new ArrayList();
        }
    }


    /**
     * Method called to associate a Ramasser object to this object
     * through the Ramasser foreign key attribute
     *
     * @param l Ramasser
     * @throws TorqueException
     */
    public void addRamasser(Ramasser l) throws TorqueException
    {
        getRamassers().add(l);
        l.setPartie((Partie) this);
    }

    /**
     * Method called to associate a Ramasser object to this object
     * through the Ramasser foreign key attribute using connection.
     *
     * @param l Ramasser
     * @throws TorqueException
     */
    public void addRamasser(Ramasser l, Connection con) throws TorqueException
    {
        getRamassers(con).add(l);
        l.setPartie((Partie) this);
    }

    /**
     * The criteria used to select the current contents of collRamassers
     */
    private Criteria lastRamassersCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getRamassers(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getRamassers()
        throws TorqueException
    {
        if (collRamassers == null)
        {
            collRamassers = getRamassers(new Criteria(10));
        }
        return collRamassers;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie has previously
     * been saved, it will retrieve related Ramassers from storage.
     * If this Partie is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getRamassers(Criteria criteria) throws TorqueException
    {
        if (collRamassers == null)
        {
            if (isNew())
            {
               collRamassers = new ArrayList();
            }
            else
            {
                criteria.add(RamasserPeer.ID_PARTIE, getIdPartie() );
                collRamassers = RamasserPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(RamasserPeer.ID_PARTIE, getIdPartie());
                if (!lastRamassersCriteria.equals(criteria))
                {
                    collRamassers = RamasserPeer.doSelect(criteria);
                }
            }
        }
        lastRamassersCriteria = criteria;

        return collRamassers;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getRamassers(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getRamassers(Connection con) throws TorqueException
    {
        if (collRamassers == null)
        {
            collRamassers = getRamassers(new Criteria(10), con);
        }
        return collRamassers;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie has previously
     * been saved, it will retrieve related Ramassers from storage.
     * If this Partie is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getRamassers(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collRamassers == null)
        {
            if (isNew())
            {
               collRamassers = new ArrayList();
            }
            else
            {
                 criteria.add(RamasserPeer.ID_PARTIE, getIdPartie());
                 collRamassers = RamasserPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(RamasserPeer.ID_PARTIE, getIdPartie());
                 if (!lastRamassersCriteria.equals(criteria))
                 {
                     collRamassers = RamasserPeer.doSelect(criteria, con);
                 }
             }
         }
         lastRamassersCriteria = criteria;

         return collRamassers;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Ramassers from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getRamassersJoinPartie(Criteria criteria)
        throws TorqueException
    {
        if (collRamassers == null)
        {
            if (isNew())
            {
               collRamassers = new ArrayList();
            }
            else
            {
                criteria.add(RamasserPeer.ID_PARTIE, getIdPartie());
                collRamassers = RamasserPeer.doSelectJoinPartie(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(RamasserPeer.ID_PARTIE, getIdPartie());
            if (!lastRamassersCriteria.equals(criteria))
            {
                collRamassers = RamasserPeer.doSelectJoinPartie(criteria);
            }
        }
        lastRamassersCriteria = criteria;

        return collRamassers;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Ramassers from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getRamassersJoinObjets(Criteria criteria)
        throws TorqueException
    {
        if (collRamassers == null)
        {
            if (isNew())
            {
               collRamassers = new ArrayList();
            }
            else
            {
                criteria.add(RamasserPeer.ID_PARTIE, getIdPartie());
                collRamassers = RamasserPeer.doSelectJoinObjets(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(RamasserPeer.ID_PARTIE, getIdPartie());
            if (!lastRamassersCriteria.equals(criteria))
            {
                collRamassers = RamasserPeer.doSelectJoinObjets(criteria);
            }
        }
        lastRamassersCriteria = criteria;

        return collRamassers;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Ramassers from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getRamassersJoinTroll(Criteria criteria)
        throws TorqueException
    {
        if (collRamassers == null)
        {
            if (isNew())
            {
               collRamassers = new ArrayList();
            }
            else
            {
                criteria.add(RamasserPeer.ID_PARTIE, getIdPartie());
                collRamassers = RamasserPeer.doSelectJoinTroll(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(RamasserPeer.ID_PARTIE, getIdPartie());
            if (!lastRamassersCriteria.equals(criteria))
            {
                collRamassers = RamasserPeer.doSelectJoinTroll(criteria);
            }
        }
        lastRamassersCriteria = criteria;

        return collRamassers;
    }





    /**
     * Collection to store aggregation of collUtilisers
     */
    protected List collUtilisers;

    /**
     * Temporary storage of collUtilisers to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initUtilisers()
    {
        if (collUtilisers == null)
        {
            collUtilisers = new ArrayList();
        }
    }


    /**
     * Method called to associate a Utiliser object to this object
     * through the Utiliser foreign key attribute
     *
     * @param l Utiliser
     * @throws TorqueException
     */
    public void addUtiliser(Utiliser l) throws TorqueException
    {
        getUtilisers().add(l);
        l.setPartie((Partie) this);
    }

    /**
     * Method called to associate a Utiliser object to this object
     * through the Utiliser foreign key attribute using connection.
     *
     * @param l Utiliser
     * @throws TorqueException
     */
    public void addUtiliser(Utiliser l, Connection con) throws TorqueException
    {
        getUtilisers(con).add(l);
        l.setPartie((Partie) this);
    }

    /**
     * The criteria used to select the current contents of collUtilisers
     */
    private Criteria lastUtilisersCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getUtilisers(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getUtilisers()
        throws TorqueException
    {
        if (collUtilisers == null)
        {
            collUtilisers = getUtilisers(new Criteria(10));
        }
        return collUtilisers;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie has previously
     * been saved, it will retrieve related Utilisers from storage.
     * If this Partie is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getUtilisers(Criteria criteria) throws TorqueException
    {
        if (collUtilisers == null)
        {
            if (isNew())
            {
               collUtilisers = new ArrayList();
            }
            else
            {
                criteria.add(UtiliserPeer.ID_PARTIE, getIdPartie() );
                collUtilisers = UtiliserPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(UtiliserPeer.ID_PARTIE, getIdPartie());
                if (!lastUtilisersCriteria.equals(criteria))
                {
                    collUtilisers = UtiliserPeer.doSelect(criteria);
                }
            }
        }
        lastUtilisersCriteria = criteria;

        return collUtilisers;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getUtilisers(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getUtilisers(Connection con) throws TorqueException
    {
        if (collUtilisers == null)
        {
            collUtilisers = getUtilisers(new Criteria(10), con);
        }
        return collUtilisers;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie has previously
     * been saved, it will retrieve related Utilisers from storage.
     * If this Partie is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getUtilisers(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collUtilisers == null)
        {
            if (isNew())
            {
               collUtilisers = new ArrayList();
            }
            else
            {
                 criteria.add(UtiliserPeer.ID_PARTIE, getIdPartie());
                 collUtilisers = UtiliserPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(UtiliserPeer.ID_PARTIE, getIdPartie());
                 if (!lastUtilisersCriteria.equals(criteria))
                 {
                     collUtilisers = UtiliserPeer.doSelect(criteria, con);
                 }
             }
         }
         lastUtilisersCriteria = criteria;

         return collUtilisers;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Utilisers from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getUtilisersJoinPartie(Criteria criteria)
        throws TorqueException
    {
        if (collUtilisers == null)
        {
            if (isNew())
            {
               collUtilisers = new ArrayList();
            }
            else
            {
                criteria.add(UtiliserPeer.ID_PARTIE, getIdPartie());
                collUtilisers = UtiliserPeer.doSelectJoinPartie(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(UtiliserPeer.ID_PARTIE, getIdPartie());
            if (!lastUtilisersCriteria.equals(criteria))
            {
                collUtilisers = UtiliserPeer.doSelectJoinPartie(criteria);
            }
        }
        lastUtilisersCriteria = criteria;

        return collUtilisers;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Utilisers from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getUtilisersJoinObjets(Criteria criteria)
        throws TorqueException
    {
        if (collUtilisers == null)
        {
            if (isNew())
            {
               collUtilisers = new ArrayList();
            }
            else
            {
                criteria.add(UtiliserPeer.ID_PARTIE, getIdPartie());
                collUtilisers = UtiliserPeer.doSelectJoinObjets(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(UtiliserPeer.ID_PARTIE, getIdPartie());
            if (!lastUtilisersCriteria.equals(criteria))
            {
                collUtilisers = UtiliserPeer.doSelectJoinObjets(criteria);
            }
        }
        lastUtilisersCriteria = criteria;

        return collUtilisers;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Utilisers from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getUtilisersJoinTroll(Criteria criteria)
        throws TorqueException
    {
        if (collUtilisers == null)
        {
            if (isNew())
            {
               collUtilisers = new ArrayList();
            }
            else
            {
                criteria.add(UtiliserPeer.ID_PARTIE, getIdPartie());
                collUtilisers = UtiliserPeer.doSelectJoinTroll(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(UtiliserPeer.ID_PARTIE, getIdPartie());
            if (!lastUtilisersCriteria.equals(criteria))
            {
                collUtilisers = UtiliserPeer.doSelectJoinTroll(criteria);
            }
        }
        lastUtilisersCriteria = criteria;

        return collUtilisers;
    }





    /**
     * Collection to store aggregation of collPlaces
     */
    protected List collPlaces;

    /**
     * Temporary storage of collPlaces to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initPlaces()
    {
        if (collPlaces == null)
        {
            collPlaces = new ArrayList();
        }
    }


    /**
     * Method called to associate a Place object to this object
     * through the Place foreign key attribute
     *
     * @param l Place
     * @throws TorqueException
     */
    public void addPlace(Place l) throws TorqueException
    {
        getPlaces().add(l);
        l.setPartie((Partie) this);
    }

    /**
     * Method called to associate a Place object to this object
     * through the Place foreign key attribute using connection.
     *
     * @param l Place
     * @throws TorqueException
     */
    public void addPlace(Place l, Connection con) throws TorqueException
    {
        getPlaces(con).add(l);
        l.setPartie((Partie) this);
    }

    /**
     * The criteria used to select the current contents of collPlaces
     */
    private Criteria lastPlacesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getPlaces(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getPlaces()
        throws TorqueException
    {
        if (collPlaces == null)
        {
            collPlaces = getPlaces(new Criteria(10));
        }
        return collPlaces;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie has previously
     * been saved, it will retrieve related Places from storage.
     * If this Partie is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getPlaces(Criteria criteria) throws TorqueException
    {
        if (collPlaces == null)
        {
            if (isNew())
            {
               collPlaces = new ArrayList();
            }
            else
            {
                criteria.add(PlacePeer.ID_PARTIE, getIdPartie() );
                collPlaces = PlacePeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(PlacePeer.ID_PARTIE, getIdPartie());
                if (!lastPlacesCriteria.equals(criteria))
                {
                    collPlaces = PlacePeer.doSelect(criteria);
                }
            }
        }
        lastPlacesCriteria = criteria;

        return collPlaces;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getPlaces(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getPlaces(Connection con) throws TorqueException
    {
        if (collPlaces == null)
        {
            collPlaces = getPlaces(new Criteria(10), con);
        }
        return collPlaces;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie has previously
     * been saved, it will retrieve related Places from storage.
     * If this Partie is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getPlaces(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collPlaces == null)
        {
            if (isNew())
            {
               collPlaces = new ArrayList();
            }
            else
            {
                 criteria.add(PlacePeer.ID_PARTIE, getIdPartie());
                 collPlaces = PlacePeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(PlacePeer.ID_PARTIE, getIdPartie());
                 if (!lastPlacesCriteria.equals(criteria))
                 {
                     collPlaces = PlacePeer.doSelect(criteria, con);
                 }
             }
         }
         lastPlacesCriteria = criteria;

         return collPlaces;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Places from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getPlacesJoinPartie(Criteria criteria)
        throws TorqueException
    {
        if (collPlaces == null)
        {
            if (isNew())
            {
               collPlaces = new ArrayList();
            }
            else
            {
                criteria.add(PlacePeer.ID_PARTIE, getIdPartie());
                collPlaces = PlacePeer.doSelectJoinPartie(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(PlacePeer.ID_PARTIE, getIdPartie());
            if (!lastPlacesCriteria.equals(criteria))
            {
                collPlaces = PlacePeer.doSelectJoinPartie(criteria);
            }
        }
        lastPlacesCriteria = criteria;

        return collPlaces;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Places from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getPlacesJoinObjets(Criteria criteria)
        throws TorqueException
    {
        if (collPlaces == null)
        {
            if (isNew())
            {
               collPlaces = new ArrayList();
            }
            else
            {
                criteria.add(PlacePeer.ID_PARTIE, getIdPartie());
                collPlaces = PlacePeer.doSelectJoinObjets(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(PlacePeer.ID_PARTIE, getIdPartie());
            if (!lastPlacesCriteria.equals(criteria))
            {
                collPlaces = PlacePeer.doSelectJoinObjets(criteria);
            }
        }
        lastPlacesCriteria = criteria;

        return collPlaces;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Partie is new, it will return
     * an empty collection; or if this Partie has previously
     * been saved, it will retrieve related Places from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Partie.
     */
    protected List getPlacesJoinCasee(Criteria criteria)
        throws TorqueException
    {
        if (collPlaces == null)
        {
            if (isNew())
            {
               collPlaces = new ArrayList();
            }
            else
            {
                criteria.add(PlacePeer.ID_PARTIE, getIdPartie());
                collPlaces = PlacePeer.doSelectJoinCasee(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(PlacePeer.ID_PARTIE, getIdPartie());
            if (!lastPlacesCriteria.equals(criteria))
            {
                collPlaces = PlacePeer.doSelectJoinCasee(criteria);
            }
        }
        lastPlacesCriteria = criteria;

        return collPlaces;
    }



        
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
            fieldNames.add("IdPartie");
            fieldNames.add("Libelle");
            fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by field (Java) name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
        if (name.equals("IdPartie"))
        {
            return getIdPartie();
        }
        if (name.equals("Libelle"))
        {
            return getLibelle();
        }
        return null;
    }

    /**
     * Set a field in the object by field (Java) name.
     *
     * @param name field name
     * @param value field value
     * @return True if value was set, false if not (invalid name / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByName(String name, Object value )
        throws TorqueException, IllegalArgumentException
    {
        if (name.equals("IdPartie"))
        {
            // Object fields can be null
            if (value != null && ! String.class.isInstance(value))
            {
                throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
            }
            setIdPartie((String) value);
            return true;
        }
        if (name.equals("Libelle"))
        {
            // Object fields can be null
            if (value != null && ! String.class.isInstance(value))
            {
                throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
            }
            setLibelle((String) value);
            return true;
        }
        return false;
    }

    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
        if (name.equals(PartiePeer.ID_PARTIE))
        {
            return getIdPartie();
        }
        if (name.equals(PartiePeer.LIBELLE))
        {
            return getLibelle();
        }
        return null;
    }

    /**
     * Set field values by Peer Field Name
     *
     * @param name field name
     * @param value field value
     * @return True if value was set, false if not (invalid name / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByPeerName(String name, Object value)
        throws TorqueException, IllegalArgumentException
    {
      if (PartiePeer.ID_PARTIE.equals(name))
        {
            return setByName("IdPartie", value);
        }
      if (PartiePeer.LIBELLE.equals(name))
        {
            return setByName("Libelle", value);
        }
        return false;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
        if (pos == 0)
        {
            return getIdPartie();
        }
        if (pos == 1)
        {
            return getLibelle();
        }
        return null;
    }

    /**
     * Set field values by its position (zero based) in the XML schema.
     *
     * @param position The field position
     * @param value field value
     * @return True if value was set, false if not (invalid position / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByPosition(int position, Object value)
        throws TorqueException, IllegalArgumentException
    {
    if (position == 0)
        {
            return setByName("IdPartie", value);
        }
    if (position == 1)
        {
            return setByName("Libelle", value);
        }
        return false;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
        save(PartiePeer.DATABASE_NAME);
    }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
     *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
        try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
    }

    /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
        if (!alreadyInSave)
        {
            alreadyInSave = true;



            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    PartiePeer.doInsert((Partie) this, con);
                    setNew(false);
                }
                else
                {
                    PartiePeer.doUpdate((Partie) this, con);
                }
            }


            if (collSaves != null)
            {
                for (int i = 0; i < collSaves.size(); i++)
                {
                    ((Save) collSaves.get(i)).save(con);
                }
            }

            if (collEquipers != null)
            {
                for (int i = 0; i < collEquipers.size(); i++)
                {
                    ((Equiper) collEquipers.get(i)).save(con);
                }
            }

            if (collRamassers != null)
            {
                for (int i = 0; i < collRamassers.size(); i++)
                {
                    ((Ramasser) collRamassers.get(i)).save(con);
                }
            }

            if (collUtilisers != null)
            {
                for (int i = 0; i < collUtilisers.size(); i++)
                {
                    ((Utiliser) collUtilisers.get(i)).save(con);
                }
            }

            if (collPlaces != null)
            {
                for (int i = 0; i < collPlaces.size(); i++)
                {
                    ((Place) collPlaces.get(i)).save(con);
                }
            }
            alreadyInSave = false;
        }
    }


    /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param key idPartie ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
        setIdPartie(key.toString());
    }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
        setIdPartie(key);
    }


    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
        return SimpleKey.keyFor(getIdPartie());
    }
 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
     * It then fills all the association collections and sets the
     * related objects to isNew=true.
     */
    public Partie copy() throws TorqueException
    {
        return copy(true);
    }

    /**
     * Makes a copy of this object using connection.
     * It creates a new object filling in the simple attributes.
     * It then fills all the association collections and sets the
     * related objects to isNew=true.
     *
     * @param con the database connection to read associated objects.
     */
    public Partie copy(Connection con) throws TorqueException
    {
        return copy(true, con);
    }

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
     * If the parameter deepcopy is true, it then fills all the
     * association collections and sets the related objects to
     * isNew=true.
     *
     * @param deepcopy whether to copy the associated objects.
     */
    public Partie copy(boolean deepcopy) throws TorqueException
    {
        return copyInto(new Partie(), deepcopy);
    }

    /**
     * Makes a copy of this object using connection.
     * It creates a new object filling in the simple attributes.
     * If the parameter deepcopy is true, it then fills all the
     * association collections and sets the related objects to
     * isNew=true.
     *
     * @param deepcopy whether to copy the associated objects.
     * @param con the database connection to read associated objects.
     */
    public Partie copy(boolean deepcopy, Connection con) throws TorqueException
    {
        return copyInto(new Partie(), deepcopy, con);
    }
  
    /**
     * Fills the copyObj with the contents of this object.
     * The associated objects are also copied and treated as new objects.
     *
     * @param copyObj the object to fill.
     */
    protected Partie copyInto(Partie copyObj) throws TorqueException
    {
        return copyInto(copyObj, true);
    }

  
    /**
     * Fills the copyObj with the contents of this object using connection.
     * The associated objects are also copied and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param con the database connection to read associated objects.
     */
    protected Partie copyInto(Partie copyObj, Connection con) throws TorqueException
    {
        return copyInto(copyObj, true, con);
    }
  
    /**
     * Fills the copyObj with the contents of this object.
     * If deepcopy is true, The associated objects are also copied
     * and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param deepcopy whether the associated objects should be copied.
     */
    protected Partie copyInto(Partie copyObj, boolean deepcopy) throws TorqueException
    {
        copyObj.setIdPartie(idPartie);
        copyObj.setLibelle(libelle);

        copyObj.setIdPartie((String)null);

        if (deepcopy)
        {


        List vSaves = getSaves();
        if (vSaves != null)
        {
            for (int i = 0; i < vSaves.size(); i++)
            {
                Save obj = (Save) vSaves.get(i);
                copyObj.addSave(obj.copy());
            }
        }
        else
        {
            copyObj.collSaves = null;
        }


        List vEquipers = getEquipers();
        if (vEquipers != null)
        {
            for (int i = 0; i < vEquipers.size(); i++)
            {
                Equiper obj = (Equiper) vEquipers.get(i);
                copyObj.addEquiper(obj.copy());
            }
        }
        else
        {
            copyObj.collEquipers = null;
        }


        List vRamassers = getRamassers();
        if (vRamassers != null)
        {
            for (int i = 0; i < vRamassers.size(); i++)
            {
                Ramasser obj = (Ramasser) vRamassers.get(i);
                copyObj.addRamasser(obj.copy());
            }
        }
        else
        {
            copyObj.collRamassers = null;
        }


        List vUtilisers = getUtilisers();
        if (vUtilisers != null)
        {
            for (int i = 0; i < vUtilisers.size(); i++)
            {
                Utiliser obj = (Utiliser) vUtilisers.get(i);
                copyObj.addUtiliser(obj.copy());
            }
        }
        else
        {
            copyObj.collUtilisers = null;
        }


        List vPlaces = getPlaces();
        if (vPlaces != null)
        {
            for (int i = 0; i < vPlaces.size(); i++)
            {
                Place obj = (Place) vPlaces.get(i);
                copyObj.addPlace(obj.copy());
            }
        }
        else
        {
            copyObj.collPlaces = null;
        }
        }
        return copyObj;
    }
        
    
    /**
     * Fills the copyObj with the contents of this object using connection.
     * If deepcopy is true, The associated objects are also copied
     * and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param deepcopy whether the associated objects should be copied.
     * @param con the database connection to read associated objects.
     */
    protected Partie copyInto(Partie copyObj, boolean deepcopy, Connection con) throws TorqueException
    {
        copyObj.setIdPartie(idPartie);
        copyObj.setLibelle(libelle);

        copyObj.setIdPartie((String)null);

        if (deepcopy)
        {


        List vSaves = getSaves(con);
        if (vSaves != null)
        {
            for (int i = 0; i < vSaves.size(); i++)
            {
                Save obj = (Save) vSaves.get(i);
                copyObj.addSave(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collSaves = null;
        }


        List vEquipers = getEquipers(con);
        if (vEquipers != null)
        {
            for (int i = 0; i < vEquipers.size(); i++)
            {
                Equiper obj = (Equiper) vEquipers.get(i);
                copyObj.addEquiper(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collEquipers = null;
        }


        List vRamassers = getRamassers(con);
        if (vRamassers != null)
        {
            for (int i = 0; i < vRamassers.size(); i++)
            {
                Ramasser obj = (Ramasser) vRamassers.get(i);
                copyObj.addRamasser(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collRamassers = null;
        }


        List vUtilisers = getUtilisers(con);
        if (vUtilisers != null)
        {
            for (int i = 0; i < vUtilisers.size(); i++)
            {
                Utiliser obj = (Utiliser) vUtilisers.get(i);
                copyObj.addUtiliser(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collUtilisers = null;
        }


        List vPlaces = getPlaces(con);
        if (vPlaces != null)
        {
            for (int i = 0; i < vPlaces.size(); i++)
            {
                Place obj = (Place) vPlaces.get(i);
                copyObj.addPlace(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collPlaces = null;
        }
        }
        return copyObj;
    }
    
    

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public PartiePeer getPeer()
    {
        return peer;
    }

    /**
     * Retrieves the TableMap object related to this Table data without
     * compiler warnings of using getPeer().getTableMap().
     *
     * @return The associated TableMap object.
     */
    public TableMap getTableMap() throws TorqueException
    {
        return PartiePeer.getTableMap();
    }


    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Partie:\n");
        str.append("IdPartie = ")
           .append(getIdPartie())
           .append("\n");
        str.append("Libelle = ")
           .append(getLibelle())
           .append("\n");
        return(str.toString());
    }
}
